import React from 'react'
import { ResultPage, Card, Button } from 'antd-mobile'
import { Tag, Space } from 'antd-mobile'

import { useNavigate, useSearchParams } from 'react-router-dom'
import style from './home.module.css'
function Index() {
  const nav = useNavigate()
  const [sp] = useSearchParams()
  const start = sp.get('start')
  const end = sp.get('end')
  const price = sp.get('price')
  const startTime = sp.get('startTime')
  const endTime = sp.get('endTime')
  const time = sp.get('time')
  const title='请支付'
  const cc = sp.get('cc')
  const id = sp.get('id')
  const zf=()=>{
    http.get('/api/pay',{
      params:{
        id,price,title
      }
    }).then((res)=>{
      console.log(res);
      if(res.code===200){
        window.location.href=res.data
      }
    })
  }
  return (
    <div>
      <ResultPage
        status='success'
        title='等待支付'
        description='请在30分钟内完成支付'
      >
        <ResultPage.Card style={{ padding: 8 }}>
          <p>订单号：E1564585415</p>
          <div>
            <div className={style.row}>
              <span className={style.pp}>{startTime}</span>
              <span>{time}</span>
              <span className={style.pp}>{endTime}</span>
              <span>{start}</span>
              <span onClick={() => { setVisible5(true) }}>{cc}时刻表</span>
              <span>{end}</span>
            </div>
          </div>
        </ResultPage.Card>

        <Card style={{  marginTop: 12 }}>
          <div>
            <p>小明  <Tag>成人票</Tag></p>
            <p>身份证 ：522224***********4512 <span  style={{float:'right'}}>￥{price}</span></p>
            <p>二等座 01车07C号 <span style={{float:'right'}}>待支付</span></p>
          </div>
        
          <p className={style.ii}>退票无忧，减免手续费</p>
         <div>
          <h4>火车票退票险（20/2人）</h4>
          <p>最高赔付100%退票手续</p>
         </div>
         <div>
          <h4>优享出票服务</h4>
          <p>￥10*2，送5元用车立减+20.5万超值保险套餐</p>
         </div>
        </Card>
        <Button block className={style.ss}   onClick={()=>nav(`/zf?start=${start}&end=${end}&startTime=${startTime}&endTime=
            ${endTime}&cc=${cc}&time=${time}&price=${price}&id=${id}`)}
          >去支付</Button>
      </ResultPage>
      
    </div>
  )
}

export default Index
